{$head_meta}
<title>{$action} | {$Think.config.title}</title>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
    <!-- BEGIN HEADER -->
    <div class="header navbar navbar-inverse navbar-fixed-top">
        <!-- BEGIN TOP NAVIGATION BAR -->
        <div class="navbar-inner">
            <div class="container-fluid">
                <!-- BEGIN LOGO -->
                <a class="brand" href="{:U('Admin/Index/index')}">
                <img src="__PUBLIC__/admin/assets/img/logo.png" alt="logo" />
                </a>
                <!-- END LOGO -->
                <!-- BEGIN RESPONSIVE MENU TOGGLER -->
                <a href="javascript:;" class="btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse">
                <img src="__PUBLIC__/admin/assets/img/menu-toggler.png" alt="" />
                </a>          
                <!-- END RESPONSIVE MENU TOGGLER -->            
                <!-- BEGIN TOP NAVIGATION MENU -->              
                <ul class="nav pull-right">
                    <!-- BEGIN USER LOGIN DROPDOWN -->
                    <li class="dropdown user">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <img alt="" src="__PUBLIC__/admin/assets/img/avatar1_small.jpg" />
                        <span class="username">{$username}</span>
                        <i class="icon-angle-down"></i>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="{:U('Admin/Index/index')}"><i class="icon-user"></i>个人信息</a></li>
                            <li class="divider"></li>
                            <li><a href="{:U('Admin/Login/logout')}"><i class="icon-key"></i>退出</a></li>
                        </ul>
                    </li>
                    <!-- END USER LOGIN DROPDOWN -->
                </ul>
                <!-- END TOP NAVIGATION MENU --> 
            </div>
        </div>
        <!-- END TOP NAVIGATION BAR -->
    </div>
    <!-- END HEADER -->
    <!-- BEGIN CONTAINER -->
    <div class="page-container row-fluid">
        <!-- BEGIN SIDEBAR -->
        <div class="page-sidebar nav-collapse collapse">
            <!-- BEGIN SIDEBAR MENU -->        
            <ul class="page-sidebar-menu">
                <li>
                    <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
                    <div class="sidebar-toggler hidden-phone"></div>
                    <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
                </li>
                {$menu}
            </ul>
            <!-- END SIDEBAR MENU -->
        </div>
        <!-- END SIDEBAR -->
        <!-- BEGIN PAGE -->
        <div class="page-content">
            <!-- BEGIN PAGE CONTAINER-->        
            <div class="container-fluid">
                <!-- BEGIN PAGE HEADER-->
                <div class="row-fluid">
                    <div class="span12">  
                        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                        <h3 class="page-title">
                            {$action}<small>&nbsp;&nbsp;{$Think.config.title}</small>
                        </h3>
                        <ul class="breadcrumb">
                            <li>
                                <a href="{$module_url}">{$module}</a>
                                <i class="icon-angle-right"></i>
                            </li>
                            <li><a href="{$action_url}">{$action}</a></li>
                        </ul>
                        <!-- END PAGE TITLE & BREADCRUMB-->
                    </div>
                </div>
                <!-- END PAGE HEADER-->
                <!-- BEGIN PAGE CONTENT-->
                <div class="row-fluid">
                    <div class="span12">
                        <form>
                        <table class="table table-striped table-bordered table-hover tab">
                            <volist name="nodeList" id="level1">
                                <tr>
                                    <td style="font-size: 14px;"><label><input name="data[]" level="1" type="checkbox" obj="node_{$level1.id}" value="{$level1.id}:1:0"/> <b>[项目]</b> {$level1.title}</label></td>
                                </tr>
                                <volist name="level1['data']" id="level2">
                                    <tr>
                                        <td style="padding-left: 30px; font-size: 14px;"><label><input name="data[]" level="2" type="checkbox" obj="node_{$level1.id}_{$level2.id}" value="{$level2.id}:2:{$level2.pid}"/> <b>[模块]</b> {$level2.title}</label></td>
                                    </tr>
                                    <tr>
                                        <td style="padding-left: 50px;">
                                            <volist name="level2['data']" id="level3">
                                                <label><input name="data[]" level="3" type="checkbox" obj="node_{$level1.id}_{$level2.id}_{$level3.id}" value="{$level3.id}:3:{$level3.pid}"/> {$level3.title}</label> &nbsp;&nbsp;&nbsp;
                                            </volist>
                                        </td>
                                    </tr>
                                </volist>
                            </volist>
                        </table>
                        <input type="hidden" name="id" value="{$info.id}"/>
                    </form>
                    <div class="span12" id="success" style="font-size:16px;color: red;text-align: left; display:none;"></div>
                    <div class="commonBtnArea" >
                        <div class="form-actions">
                            <div class="span2"><button class="btn blue submit">提交</button></div>
                            <div class="span2"><button class="btn white reset">重置</button></div>
                            <div class="span2"><button type="button" class="btn red empty" id="check_cancel">清空</button></div>
                        </div>                        
                    </div>
                    </div>
                </div>
                <!-- END PAGE CONTENT-->
            </div>
            <!-- END PAGE CONTAINER-->
        </div>
        <!-- END PAGE -->
    </div>
    <!-- END CONTAINER -->
    {$footer}
    <script src="__PUBLIC__/admin/assets/plugins/jquery-1.10.1.min.js" type="text/javascript"></script>  
    <script type="text/javascript" src="__PUBLIC__/js/functions.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery.form.js"></script>
    <script>
        jQuery(document).ready(function() {

            $("#check_cancel").click(function() {
                $("#cache_table :checkbox").attr("checked", false);
                $("span").removeClass("checked"); 
            });

            //初始化数据
            function setAccess(){
                //清空所有已选中的
                $("input[type='checkbox']").prop("checked",false);
                //数据格式：
                //节点ID：node_id；1，项目；2，模块；3，操作
                //节点级别：level；
                //父级节点ID：pid
                var access=$.parseJSON('{$info.access}');
                var access_length=access.length;
                if(access_length>0){
                    for(var i=0;i<access_length;i++){
                        $("input[type='checkbox'][value='"+access[i]['val']+"']").prop("checked","checked");
                    }
                }
            }
            //执行初始化数据操作
            setAccess();
            //为项目时候全选本项目所有操作
            $("input[level='1']").click(function(){
                var obj=$(this).attr("obj")+"_";
                $("input[obj^='"+obj+"']").prop("checked",$(this).prop("checked"));
            });
            //为模块时候全选本模块所有操作
            $("input[level='2']").click(function(){
                var obj=$(this).attr("obj")+"_";
                $("input[obj^='"+obj+"']").prop("checked",$(this).prop("checked"));
                //分隔obj为数组
                var tem=obj.split("_");
                //将当前模块父级选中
                if($(this).prop('checked')){
                    $("input[obj='node_"+tem[1]+"']").prop("checked","checked");
                }
            });
            //为操作时只要有勾选就选中所属模块和所属项目
            $("input[level='3']").click(function(){
                var tem=$(this).attr("obj").split("_");
                if($(this).prop('checked')){
                    //所属项目
                    $("input[obj='node_"+tem[1]+"']").prop("checked","checked");
                    //所属模块
                    $("input[obj='node_"+tem[1]+"_"+tem[2]+"']").prop("checked","checked");
                }
            });
            //重置初始状态，勾选错误时恢复
            $(".reset").click(function(){
                setAccess();
            });
            //清空当前已经选中的
            $(".empty").click(function(){
                $("input[type='checkbox']").prop("checked",false);
            });
            $(".submit").click(function(){
                commonAjaxSubmit();
            });
        });
    </script>
</body>
<!-- END BODY -->
</html>